/**
 * http://usejsdoc.org/
 */
var http = require('http'),
	url = require('url'),
	querystring = require('querystring');

/**创建http服务器*/
http.createServer(function(req,res){
	/**web客户端请求*/
	var pathname = url.parse(req.url).pathname,//获取url请求路径
		paramStr = url.parse(req.url).query,//获取url请求参数
		param = querystring.parse(paramStr);//将url请求参数转化为json对象
	if('/favicon.ico' === pathname){
		return;
	}
	
	//打印参数信息
	console.log(pathname);
	console.log(paramStr?paramStr:'no params');
	console.log(param);
	res.writeHead( 200 , {"Content-Type":"text/html"});
	res.end('success');
	
}).listen(8080,'127.0.0.1');
console.log('Server running at http://127.0.0.1:8080');